package org.example;

import com.example.entity.Product;
import com.example.entity.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 1. 创建Spring IOC容器
        ApplicationContext context =
                new ClassPathXmlApplicationContext("applicationContext.xml");

        // 2. 从容器中获取bean
        Product product = (Product) context.getBean("product");
        Student student = (Student) context.getBean("student");

        // 3. 输出bean内容
        System.out.println("=== Product信息 ===");
        System.out.println(product);

        System.out.println("\n=== Student信息 ===");
        System.out.println(student);
    }
}
